from connect.conn_mysql import Connect

class Account(Connect):

    def insert_phone_pwd(self,phone,pass_word):
        '''保存用户的账号和验证码到数据库'''
        save_sql = '''
        insert into user(phone,password)
        values(%s,%s)
        '''
        self.insert(save_sql,(phone,pass_word))

    def insert_phone_code(self):
        save_sql = '''
        insert into verify_code(phone,verify_code)value(%s,%s)
        '''
        self.insert(save_sql,(phone,verify_code))

    def compare_phone(self,phone):
        compare_sql = '''
        select * from user where phone = %s
        '''
        result = self.select_one(compare_sql,(phone,))
        return result

    def copare_verify_code(self,phone_verify_code):
        verify_sql = '''
        select * from verify_code where phone_verify_code = %s
        '''
        result = self.select_one(verify_sql,(phone_verify_code,))